// @ts-ignore
/* eslint-disable */
import request from '@/services/request';

/** 查全部 GET /v1/admins */
export async function adminV1AdminControllerIndex(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.AdminV1AdminControllerIndexParams,
  options?: { [key: string]: any },
) {
  return request<{ total: number; list: API.AdminIndexResult[] }>('/v1/admins', {
    method: 'GET',
    params: {
      // pageIndex has a default value: 1
      pageIndex: '1',
      // pageSize has a default value: 10
      pageSize: '10',
      ...params,
    },
    ...(options || {}),
  });
}

/** 新增 POST /v1/admins */
export async function adminV1AdminControllerCreate(
  body: API.AdminCreateDto,
  options?: { [key: string]: any },
) {
  return request<any>('/v1/admins', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 修改 PATCH /v1/admins/${param0} */
export async function adminV1AdminControllerUpdate(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.AdminV1AdminControllerUpdateParams,
  body: API.AdminUpdateDto,
  options?: { [key: string]: any },
) {
  const { uuid: param0, ...queryParams } = params;
  return request<any>(`/v1/admins/${param0}`, {
    method: 'PATCH',
    headers: {
      'Content-Type': 'application/json',
    },
    params: { ...queryParams },
    data: body,
    ...(options || {}),
  });
}

/** 管理员登录 POST /v1/admins/login */
export async function adminV1AdminControllerLogin(
  body: API.AdminLoginDto,
  options?: { [key: string]: any },
) {
  return request<API.AdminLoginResult>('/v1/admins/login', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 管理员登出 POST /v1/admins/logout */
export async function adminV1AdminControllerLogout(options?: { [key: string]: any }) {
  return request<any>('/v1/admins/logout', {
    method: 'POST',
    ...(options || {}),
  });
}

/** 查自己 GET /v1/admins/mine */
export async function adminV1AdminControllerMine(options?: { [key: string]: any }) {
  return request<API.AdminMineResult>('/v1/admins/mine', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 修改 PATCH /v1/admins/mine */
export async function adminV1AdminControllerUpdateMine(
  body: API.AdminUpdateMinePasswordDto,
  options?: { [key: string]: any },
) {
  return request<any>('/v1/admins/mine', {
    method: 'PATCH',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 修改自己密码 PUT /v1/admins/mine/password */
export async function adminV1AdminControllerUpdateMinePassword(
  body: API.AdminUpdateMinePasswordDto,
  options?: { [key: string]: any },
) {
  return request<any>('/v1/admins/mine/password', {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}
